#!/bin/bash

name=`sed -n '/Name:/p' ./accx.spec |grep -v "#" |awk '{printf $2}'`
version=`sed -n '/Version:/p' ./accx.spec | grep -v "#" | awk '{printf $2}'`
release=`sed -n '/Release:/p' ./accx.spec | grep -v "#" | awk '{printf $2}'`
buildTime=`date "+%Y-%m-%d %H:%M:%S"`
svnVersion=`svn info ./generateInfo.sh | grep Revision | awk '{printf $2}'`
builder=`whoami`
arch=`uname -m`
rpmPostfix=$arch.rpm

load=$name-$version-$release-$svnVersion.$rpmPostfix

echo "name=$name"
echo "version=$version"
echo "release=$release"
echo "buildTime=$buildTime"
echo "load=$load"

if [ -s loadInfo.txt ];then
    rm loadInfo.txt
    touch loadInfo.txt
else
    touch loadInfo.txt
fi

echo "load = $load" >> loadInfo.txt
echo "version = $svnVersion" >> loadInfo.txt
echo "buildTime = $buildTime" >>loadInfo.txt
echo "builder = $builder" >>loadInfo.txt
echo "release = $version" >> loadInfo.txt
exit 0
